import hasRole from './permission/hasRole'
import hasPermi from './permission/hasPermi'
import dialogDrag from './dialog/drag'
import dialogDragWidth from './dialog/dragWidth'
import dialogDragHeight from './dialog/dragHeight'
import imgError from './imgError/index'
import clipboard from './module/clipboard'
import maxLenght from './maxLength/index'
import { decodeMobile, decodeMobileWithSecret, encryptDesMobile } from './mobileDecode'
const install = function(Vue) {
  Vue.directive('hasRole', hasRole)
  Vue.directive('hasPermi', hasPermi)
  Vue.directive('clipboard', clipboard)
  Vue.directive('dialogDrag', dialogDrag)
  Vue.directive('dialogDragWidth', dialogDragWidth)
  Vue.directive('dialogDragHeight', dialogDragHeight)
  Vue.directive('imgError', imgError)
  Vue.directive('maxLenght', maxLenght)
  Vue.filter('encryptDesMobile', encryptDesMobile) // 加密手机号
  Vue.filter('decodeMobile', decodeMobile) // 解密手机号
  Vue.filter('decodeMobileWithSecret', decodeMobileWithSecret) // 解密后脱敏带星号手机号
}

if (window.Vue) {
  window['hasRole'] = hasRole
  window['hasPermi'] = hasPermi
  Vue.use(install); // eslint-disable-line
}

export default install
